#include <Address.h>
#include <string>
#include <string.h>
#include <arpa/inet.h>

// Constructores
Address::Address()
{
}

Address::Address(IP ip, word port) : ip(ip), port(port)
{
}

Address::~Address()
{
}

// Metodes
IP Address::getIP()
{
   return ip;
}

word Address::getPort()
{
   return port;
}

string Address::toString()
{
   char aux[256];
   memset(aux, 0, 256);
   
   sprintf(aux, ":%u", port);

   return ip.getHostname().append(aux);
}
